<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>UDT Reference</title>
</head>

<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table3" bgcolor="#99CCFF" bordercolor="#99CCFF">
  <tr>
    <td width="100%"><font face="Verdana" size="2"><i>&nbsp;UDT </i></font><i>
	<font face="Verdana" size="2">Tutorial</font></i></td>
  </tr>
</table>
<h1><font face="Verdana" size="4">Introduction to programming with UDT</font></h1>
<p><font face="Verdana" size="2">There are three ways to use UDT in your 
application. If you want to write a new application you can use the UDT API 
directly, which is similar to socket API. If you have already an application 
that uses certain network programming framework (e.g., XIO), you can write a 
UDT driver for that application. Finally, if your application does NOT use 
fork() with sockets, you can recompile your application by linking it with the 
UDT library (with -DCAPI compile option when compiling UDT) without any changes 
to your source code!</font></p>
<p><font face="Verdana" size="2">Below is a brief description on how to use UDT 
in a C++ program. UDT is a written in C++. Using UDT is almost the same as using regular 
socket API. That is, you can easily translate a network application that was using 
socket API into a new one using UDT API.</font></p>
<p><font face="Verdana" size="2">For example:</font></p>
<p><font face="Verdana" size="2">in socket, you write:</font></p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table4" bgcolor="#C0C0C0" bordercolor="#C0C0C0">
  <tr>
    <td width="100%">
<p style="margin-top: 0; margin-bottom: 0"><font size="1" face="Courier New">int s = socket(AF_INET, SOCK_STREAM, 0);</font></p></td>
  </tr>
</table>
<p><font face="Verdana" size="2">its counterpart in UDT is:</font></p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table5" bgcolor="#C0C0C0" bordercolor="#C0C0C0">
  <tr>
    <td width="100%">
<p style="margin-top: 0; margin-bottom: 0"><font size="1" face="Courier New">UDTSOCKET u = UDT::socket(AF_INET, SOCK_STREAM, 0); </font></p></td>
  </tr>
</table>
<p><font face="Verdana" size="2">UDT defines its own namespace <i>UDT</i> to 
differentiate the UDT APIs from the regular socket APIs. In the above example, a 
qualifier of <i>UDT::</i> is put before the UDT socket call. <i>UDTSOCKET</i> is 
a data type to describe a UDT socket. For a complete UDT structures and constant 
definitions, please see <a href="structure.htm">Reference:UDT Structures</a>. 
For a complete description of UDT socket APIs, please see <a href="function.htm">
Reference:UDT Functions</a>.</font></p>
<p><font face="Verdana" size="2">For those socket APIs that does not involve with a 
socket descriptor, e.g., <u>inet_pton</u>, they are not wrapped by UDT API, and the 
applications should continue to use the original functions. For those socket APIs 
or options not appropriate to UDT, e.g., SOCK_DGRAM option, they are simply not 
available in UDT API.</font></p>
<p><font face="Verdana" size="2">UDT methods are thread safe. However, it does
NOT support fork() operation and the manner after fork() is undefined.</font></p>
<p><font face="Verdana" size="2">Any applications using UDT should use the 
following header and one of the libraries, depending on the platform.</font></p>
<h4>
<font face="Verdana" size="2">Header</font></h4>
<h4>
<span style="font-weight: 400"><font face="Verdana" size="2" color="#FF0000">
#include &lt;udt.h&gt;</font></span></h4>
<h4>
<font face="Verdana" size="2">Library</font></h4>
<P style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="2" color="#FF0000">libudt.so</font></P>
<P style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="2" color="#FF0000">libudt.a</font></P>
<P style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="2" color="#FF0000">udt.dll</font></P>
<P style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="2" color="#FF0000">udt.lib</font></P>
<P style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="2" color="#FF0000">udt.dylib</font></P>

</body>

</html>
